<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
  <div container row style="margin-top: 1rem;">

  </div>

  <script>

      'use strict'

      function xyz (x, y, z) {
        return (x+y) / z;
      }

      let xyz_pxy = new Proxy(xyz, {
        apply: function (xyz, th, args) {
          if (args.length < 3) {
            throw new Error('参数不足。')
          } else if (args[2] == 0) {
            throw new Error('除数不能为0。')
          }

          return xyz.apply(th, args)
        }
      })

      console.log(xyz_pxy(2,3,0))


  </script>
</body>
</html>
